from scapy.all import Packet, ShortField, bind_layers

TUNNEL_TYPE = 0x1212
IPV4_TYPE = 0x0800

class MyTunnel(Packet):
    """Custom tunnel header definition"""
    name = "MyTunnel"
    fields_desc = [
        ShortField("protocol_id", 0),
        ShortField("dest_id", 0)
    ]
    
    def summary(self):
        return f"proto_id={self.protocol_id}, dest_id={self.dest_id}"


# Layer binding
bind_layers(Ether, MyTunnel, type=TUNNEL_TYPE)
bind_layers(MyTunnel, IP, protocol_id=IPV4_TYPE)